<template>
  <div class="welcome-container">
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="username" label="登入账户" width="180">
      </el-table-column>
      <el-table-column prop="lastLogin.ip" label="上次登入ip" width="180">
      </el-table-column>
      <el-table-column prop="lastLogin.loginTime" label="上次登入时间" sortable>
      </el-table-column>
      <el-table-column prop="nowLogin.ip" label="本次登入ip"> </el-table-column>
      <el-table-column prop="nowLogin.loginTime" label="本次登入时间">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import * as api from '@/api/users'

export default {
  meta: {
    title: 'glsy',
    icon: 'iconfont icon-shouye1'
  },
  async created() {
    let res = await api.getLoginLog('', 15)
    // console.log(res.data)
    let { state, data } = res.data
    if (state) {
      // 获取登入日志成功
      this.tableData = data
    }
  },
  data() {
    return {
      tableData: []  // 接收登入日志数据
    }
  }
}
</script>

<style lang="less" scoped>
.welcome-container {
  /deep/ .el-table .el-table__cell {
    text-align: center !important;
  }
}
</style>
